package com.eee.machine.dao.mapper;

import com.eee.machine.beans.TMachine;
import com.eee.machine.beans.TMachineExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

public interface TMachineMapper {
    long countByExample(TMachineExample example);

    int deleteByExample(TMachineExample example);

    int deleteByPrimaryKey(String machineId);

    int insert(TMachine record);

    int insertSelective(TMachine record);

    List<TMachine> selectByExample(TMachineExample example);

    TMachine selectByPrimaryKey(String machineId);

    int updateByExampleSelective(@Param("record") TMachine record, @Param("example") TMachineExample example);

    int updateByExample(@Param("record") TMachine record, @Param("example") TMachineExample example);

    int updateByPrimaryKeySelective(TMachine record);

    int updateByPrimaryKey(TMachine record);

    @Update("update t_machine set status = 0 , error_code = #{errorCode} where machine_id = #{machineId}")
    int malfunction(@Param("machineId") String machineId, @Param("errorCode") String errorCode);

    @Update("update t_machine set is_binded = 1 where machine_id = #{machineId}")
    int updateMachineBindStatus(@Param("machineId") String machineId);

    @Update("<script>" +
            "update t_machine set status = 1 where machine_id in " +
            "<foreach collection='machineIds' item='item' open='(' close=')' separator=','>" +
            " #{item} "+
            "</foreach> " +
            "</script>")
    int recover(@Param("machineIds") List<String> machineIds);
}